<%
    var isAdd = false;
    if(isEmpty(skuOpt)){
        isAdd = true;
}%>
  <% 
    var headContent = {
  %>
  <style type="text/css">
 /*验证：提示信息样式 begin*/
   .am-alert-danger {
      background-color: transparent;
      border-color: transparent;
      color: red;
    }
    .am-alert {
      margin-bottom: 1em;
      padding: .625em;
      background: transparent;
      border: none;
      border-radius: 0;
    }
    /*验证：提示信息样式 end*/
}
 </style>
<script type="text/javascript">
    $(function(){
        $("#isEnabledSwitch").on('switchChange.bootstrapSwitch',function(event, state) {
          if (state.toString() == "true") {
            $("#isEnabled").val("1");
          } else {
            $("#isEnabled").val("0");
          }
        });
        $("#submit").on("click",function(){
            $("#form").submit();
        });
    });
</script>
 <%
};
%>
<%layout("/common/_layout.html",{head:headContent}){%>
<form id="form"  method="POST" class="am-form" action="${base}/sku/saveOpt?skuId=${sku.id!}" data-am-validator>
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">当前Sku（${sku.name!}）的属性值管理</strong> / <small><%if(isAdd){%>添加（${sku.name!}）的属性值<%}else{%>编辑（${sku.name!}）的属性值<%}%></small></div>
  </div>
<input type="hidden" id="id" name="skuOpt.id" value="${skuOpt.id!}" />
<input type="hidden" id="skuId" name="skuOpt.sku_id" value="${sku.id!}" />
<input type="hidden" id="isAdd" name="isAdd" value="${isAdd!}" />
  <!--选项卡（tabs）begin-->
  <div class="am-tabs am-margin" data-am-tabs>
    <ul class="am-tabs-nav am-nav am-nav-tabs">
      <li class="am-active"><a href="#tab1"><%if(isAdd){%>添加Sku属性值<%}else{%>编辑Sku属性值<%}%></a></li>
    </ul>
    <div class="am-tabs-bd">
      <div class="am-tab-panel am-active" id="tab1">
          <!--验证表单元素（validate) begin-->
          <!--input begin-->
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">
              <span  style="color: red;">*</span>名称：
            </div>
            <div class="am-u-sm-6 am-u-md-6">
              <input type="text" id="name" name="skuOpt.name" value="${skuOpt.name!}" minlength="1" maxlength="32" placeholder="请输入sku属性值名称" required/>
            </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg">
              <div class="am-alert am-alert-danger">${skuOptNameMessages!}</div>
            </div>
          </div>
          
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">
              <span  style="color: red;">*</span>code：
            </div>
            <div class="am-u-sm-6 am-u-md-6">
              <input type="text" id="code" name="skuOpt.code" value="${skuOpt.code!}" minlength="2" maxlength="32" placeholder="请输入sku属性值代码" required/>
            </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg">
              <div class="am-alert am-alert-danger">${skuOptCodeMessages!}</div>
            </div>
          </div>
<!--
          <div class="am-g am-form-group am-margin-top">
            <div class="am-u-sm-4 am-u-md-2 am-text-right">是否启用：</div>
            <div class="am-u-sm-6 am-u-md-6">
                <div class="switch-button"> 
                        <input id="isEnabledSwitch" type="checkbox" data-size='xs' data-am-switch  data-off-text="已停用" data-on-text="已启用"  
                        <%if(isAdd || skuOpt.enabled==1){%>
                                checked="checked"
                        <%}else{%><%}%>
                        />
                        <input type="hidden" class="am-input-sm" name="skuOpt.enabled" id="isEnabled"
                            value="${(isAdd || skuOpt.enabled==1)?1:0}" />
                </div>
            </div>
            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
          </div>
-->        
            <input type="hidden" class="am-input-sm" name="skuOpt.enabled" id="isEnabled"
                            value="1" />
          <!--验证表单元素（validate end-->
      </div>
      </div>
  </div>
  </form>
  <!--选项卡（tabs）end-->
  <div class="am-margin">
    <button type="button" id="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
    <button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="window.history.back(); return false;">返回上一级</button>
  </div>

<%}%>